<script type="text/javascript">
    function mycarousel_initCallback(carousel)
    {
        // Disable autoscrolling if the user clicks the prev or next button.
        carousel.buttonNext.bind('click', function() {
            carousel.startAuto(0);
        });

        carousel.buttonPrev.bind('click', function() {
            carousel.startAuto(0);
        });

        // Pause autoscrolling if the user moves with the cursor over the clip.
        carousel.clip.hover(function() {
            carousel.stopAuto();
        }, function() {
            carousel.startAuto();
        });
    };

    jQuery(document).ready(function() {
        jQuery('#mycarousel').jcarousel({
            auto: 4,
            initCallback: mycarousel_initCallback,
            wrap: 'circular'
        });
    });

</script>
<div class="ds-sanpham">
    <? if ($pdBestSell > 0): ?>
        <div class="slideSPBanChay">
            <ul id="mycarousel" class="jcarousel-skin-tango">
                <? foreach ($pdBestSell as $rows): ?>
                    <li>
                        <div class="BSell_wrapper">
                            <a href="<? echo site_url('chi-tiet/' . $rows->FSlug . '-' . $rows->FID); ?>"><img src="<?= base_url(); ?>images/sanpham/<?= $rows->FPicture; ?>" width="150" height="150" alt="<?= $rows->FName; ?>"/></a>
                            <div class="text"><a class="link_text" href="<? echo site_url('product/detail/' . $rows->FID); ?>"><?= $rows->FName ?></a></div>
                            <div class="price"><?= format_price($rows->FPrice, 'đ') ?></div>
                        </div>
                    </li>
                <? endforeach; ?>
            </ul>
        </div>
        <div class="clear">&nbsp;</div>
    <? endif; ?>
    <div id="SpMoi">
        <h2 class="StrongHeadMain">Sản phẩm mới</h2>
        <?
        if ($product_new > 0) {
            $i = 0;
            foreach ($product_new as $row) {
                $i++;
                ?>
                <div class="box">
                    <div class="ProductCells">
                        <a href="<? echo site_url('chi-tiet/' . $row->FSlug . '-' . $row->FID); ?>"><img src="<?= base_url(); ?>images/sanpham/<?= $row->FPicture ?> " width="170" height="199"/></a>
                        <div class="text"><a class="link_text" href="<? echo site_url('product/detail/' . $row->FID); ?>"><?= $row->FName ?></a></div>
                        <div class="price"><?= format_price($row->FPrice, 'đ') ?></div>
                    </div>
                </div>
                <?
            }
        } else {
            ?>
            <p>Sản phẩm đang cập nhật</p>
            <?
        }
        ?>
    </div>
    <div class="clear"></div>
</div>